<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateProjectReviewOptionsTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('project_review_options', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '项目审核配置']);
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'limit' => 11, 'default' => 0, 'comment' => '所属项目id'])
            ->addColumn('name', 'string', ['default' => '', 'limit' => 255, 'comment' => '名字'])
            ->addColumn('json', 'json', ['null' => true, 'comment' => 'json字段，存储自定义字段'])
            ->addColumn('created_by', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建人'])
            ->addColumn('updated_by', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '更新人'])
            ->addColumn('created', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->addColumn('updated', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '更新时间'])
            ->create();
    }

    public function down()
    {
        $this->table('project_review_options')->drop()->save();
    }
}
